<template>
  <div>
    <!-- 精选专题  -->
    <div class="div_boxs">
      <h1 class="h1_line" @click="choiceness">精选专题 ></h1>
      <div class="div_line">
        <ul class="ul_line">
          <li
            v-for="(item, index) in newslist"
            :key="index"
            class="li_line"
            @click="addlists(item.id)"
          >
            <img :src="item.pic" alt="" />
            <p>{{ item.title }}</p>
            <p>{{ item.descript }}</p>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newslist: [],
    };
  },
  mounted() {
    this.$APL.NEWSLIST().then((res) => {
      // console.log(res.data.data);
      this.newslist = res.data.data;
    });
  },

  methods: {
    //精选专题
    choiceness() {
      this.$router.push({ path: "/about" });
    },

    addlists(id) {
      console.log(id);
      this.$router.push({ path: "/detail", query: { id } });
    },
  },
};
</script>
<style lang="scss">
.div_boxs {
  width: 100%;
  background: white;
  margin-top: 0.2rem;
}
.div_line {
  width: 100%;
  overflow: scroll;
}
.li_line {
  width: 90%;
  margin: 0.2rem;
  // overflow: scroll;

  img {
    width: 100%;
    height: 4rem;
    border-radius: 0.1rem;
  }
  p {
    &:nth-child(2) {
      // color: gainsboro;
      font-size: 12px;
    }
    &:nth-child(3) {
      margin-top: 0.2rem;
      font-size: 10px;
      color: gainsboro;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    }
  }
}
.ul_line {
  width: 7rem;
  display: flex;
  justify-content: flex-start;
}
.h1_line {
  width: 100%;
  text-align: center;
  font-size: 0.5rem;
}
</style>